'use strict';
module.exports = app => {
  const { INTEGER, DECIMAL,STRING } = app.Sequelize;
    const Model = app.model.define(
      'staffBalance',
      {
          id: {type: INTEGER, primaryKey: true, autoIncrement: true},
          staff_id: INTEGER,
          order_no: STRING(255),
          order_id: INTEGER,
          desc: STRING(255),
          type: INTEGER, // 1 收入 2 支出 3 手动派发
          project_amount: DECIMAL(10,2),
          travel_mode_fee: DECIMAL(10,2),
          amount: DECIMAL(10,2),
          status: INTEGER,
          image:STRING(255),
          remark:STRING(255),
      },
      {
          tableName: 'staff_balance',
          timestamps: true, // 启用时间戳(createdAt, updatedAt)
          updatedAt: 'updated_time', // 不想要 updatedAt
          createdAt: 'create_time', // 想要  createdAt 但是希望名称叫做 created_at
      }
  );
    Model.associate = function() {
        app.model.StaffBalance.belongsTo(app.model.Staff, { foreignKey: 'staff_id', targetKey: 'id' });
    }
    return Model;
};
